<template>
  <div class="header">
    <div class="bgimg">
      <div class="img"></div>
    </div>
    <div class="info-card">
      <div class="shopimg">
        <!-- <img src="~assets/img/蜜雪.jpg" alt=""> -->
      </div>
      <div class="h-content">
        <div class="title">{{ this.restInfo.name }}</div>
        <div class="detail">
          <span class="send">蓝骑士专送</span
          ><span v-for="item in this.restInfo.supports">{{ item.name }}</span>
        </div>
        <div class="notice">公告:...</div>
        <div class="coupons">
          <span v-for="iitem in this.restInfo.activities">{{
            iitem.name
          }}</span>
        </div>
        <!-- <div class="special"><span>满减</span></div> -->
        <div class="special">{{ this.restInfo.category }}</div>
        <div class="discount" @click="detailShow = true">
          {{ count }}个优惠<img src="~assets/img/箭头.png" alt="">
        </div>
      </div>
    </div>

    <!-- 优惠弹框 -->
    <transition>
      <!-- <div class="disdetail" v-if="detailShow">
        <h3>这是一个H3</h3>
      </div> -->
      <van-overlay :show="detailShow">
        <div class="disdetail">
          <div class="title">红包优惠</div>
          <img src="~assets/img/删除.png" class="fa-ban" @click="detailShow = false"></img>
          <div class="offer-details">
            <div v-for="iiitem in this.restInfo.supports">
              {{iiitem.description}}
            </div>
          </div>
        </div>
      </van-overlay>
    </transition>
  </div>
</template>

<script>
export default {
  name: "v-header",
  props: {
    restInfo: {
      type: Object,
    },
  },
  data() {
    return {
      detailShow: false,
    };
  },
  computed: {
    count: function () {
      if (this.restInfo.supports) return this.restInfo.supports.length;
    },
  },
};
</script>
 
<style scoped>
.header {
    position: relative;
  /* background-color: #f1f1f1; */
  background-color: rgb(252, 252, 252);
  /* height: 100%; */
  height: 250px;
  z-index: 99;
}
.header .bgimg {
  width: 100%;
  height: 150px;
  overflow: hidden;
  margin-bottom: 95px;
}
.header .bgimg .img {
  width: 100%;
  height: 100%;
  background: url(~assets/img/蜜雪.jpg) center center;
}

.info-card {
  width: 94%;
  background-color: rgb(250, 250, 250);
  height: 135px;
  border-radius: 10px;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 110px;
  left: 3%;
  z-index: 1;
}
.info-card .h-content {
  margin: 15px;
}
.info-card .h-content div {
  margin-bottom: 5px;
  font-size: 12px;
}
.info-card .h-content .title {
  font-size: 18px;
  font-weight: bolder;
}
.info-card .h-content .detail span {
  color: #616161;
  padding: 1px;
}
.info-card .h-content .detail .send {
  display: inline-block;
  border: 1px solid #7fc7e9;
  color: #009be2;
  padding: 1px;
  border-radius: 2px;
  margin-right: 7px;
}
.info-card .h-content .notice {
  color: #616161;
}
.info-card .h-content .coupons span {
  display: inline-block;
  /* background: url() no-repeat ; */
  /* width: 90px; */
  text-align: center;
  width: fit-content;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  height: 17px;
  line-height: 17px;
  border: 2px rgb(199, 63, 29) dotted;
  color: white;
  background-color: rgb(224, 122, 74);
}
.info-card .h-content .special span {
  display: inline-block;
  height: 12px;
  border: 1px solid rgb(199, 63, 29);
  color: rgb(199, 63, 29);
  padding: 1px;
  border-radius: 4px;
}
.info-card .shopimg {
  position: absolute;
  width: 54px;
  height: 54px;
  background-image: url("~assets/img/蜜雪.jpg");
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  right: 10px;
  top: 10px;
  border-radius: 4px;
}
.info-card .h-content .discount {
  color: #616161;
  font-size: 12px;
  position: absolute;
  bottom: 15px;
  right: 20px;
}
.info-card .h-content .discount img{
  height: 16px;
  width: 16px;
  position: absolute;
  top: 0;
  right: -15px;
}

/* 详情弹框 */
.disdetail {
  background-color: rgb(251, 251, 251);
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 65%;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px; 
}
.disdetail .title{
  font-size: 16px;
  width: 70px;
  margin: auto;
  margin-top: 15px;
  font-weight: bolder;
}
.fa-ban{
  width: 15px;
  height: 15px;
  position: absolute;
  right: 20px;
  top: 15px;
}
.disdetail .offer-details{
  margin: 15px;
  font-size: 12px;
  color: #616161
}
.disdetail .offer-details div{
  margin-bottom: 4px;
}
</style>